While working on a ProDOS disk cache program (in software) I, of course,
crashed the volume directory on a 5 meg hard disk volume - wiped it clean, all 4 blocks, and of course my backup was a month old. Provided an
interesting opportunity to experiment with a recovery technique.
Everybody knows that there is no track/sector list available for all files on
a prodos disk. The method described in beneath apple prodos suggests looking
for key blocks that are basically the prodos equivalent of t/s lists. My
approach was easier though and might suggest some steps users can take to
make their disks more recoverable when things like this happen.
It turns out that my volume directory contained about 15 files, all but 3 of
these (PRODOS, CP.SYSTEM, and CP.KEYS) were DIR files. Those are easily
replacable. All you have to do to recover all the rest of the files is use
DiskWorks to create a blank directory (following the structure in BAP). THen
you use the ascii search feature of DiskWorks and search for the ascii string
"HUSTON". Yep, he left his name in the reserved 8 bytes at the front of
every subdirectory on a ProDOS disk. Nice touch eh? You then write down the
block number of each subdirectory found by this technique. You really only
need to write down the block numbers of the top level directories though. In
my case I had to fill in entries for 13 dir files. After this and adding new
copies of Prodos, cp.system, and cp.keys my 5 meg prodos volume was
completely restored enough that I could then back up the volume, reformat,
and restore the volume for extra measure.
One pitfall in this method is that Diskworks was unable to recognize the
volume as a prodos volume and insisted on displaying tracks and sectors. This was a pain to get around. What I had to do was to use another disk zapper that always assumes a block device (ProZap from Call A.P.P.L.E) and put enough of the volume directory in to make the disk look like ProDOS to DiskWOrks which is otherwise much easier to use than ProZap.
Obviously it wouldn't be too tough to write a little utility to find these
subdirectory blocks and by checking the parent pointer, the utility could
filter out all but the top level subdirectories.
Another nice utility would be one that would copy the volume directory into a
backup directory file. I.e. store the volume directory as a subdirectory so
you'd always have dual access to the files (i.e. through two directories).
This would only work for files that don't move or significantly change in
size between backups and would only help when only the volume directory is
crashed, i.e. not the whole disk where you are pretty much out of luck anyway.
I'll let you folks know if I write any of the above but in the mean-time I'm
gonna work on the disk cache program awhile, maybe testing it on the floppies
next time.
All you have to do to recover all the rest of the files is use